{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import sys\n",
    "import numpy as np\n",
    "np.set_printoptions(threshold=np.inf)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "o_result = \"output/output_o.bin\"\n",
    "o_golden = \"output/output_o_golden.bin\"\n",
    "ho_result = \"output/output_ho.bin\"\n",
    "ho_golden = \"output/output_ht_golden.bin\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a_input = \"input/input_a.bin\"\n",
    "a_result = np.fromfile(a_input, dtype=np.float32) \n",
    "a_result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "b_input = \"input/input_b.bin\"\n",
    "b_result = np.fromfile(b_input, dtype=np.float32) \n",
    "b_result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "q_input = \"input/input_q.bin\"\n",
    "q_result = np.fromfile(q_input, dtype=np.float32) \n",
    "q_result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "k_input = \"input/input_k.bin\"\n",
    "k_result = np.fromfile(k_input, dtype=np.float32) \n",
    "k_result"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "v_input = \"input/input_v.bin\"\n",
    "v_result = np.fromfile(v_input, dtype=np.float32) \n",
    "v_result"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "o_result = np.fromfile(o_result, dtype=np.float32) # 从bin文件读取实际运算结果\n",
    "o_result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "ho_result = np.fromfile(ho_result, dtype=np.float32) # 从bin文件读取实际运算结果\n",
    "ho_result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "o_golden = np.fromfile(o_golden, dtype=np.float32) # 从bin文件读取预期运算结果\n",
    "o_golden"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "ho_golden = np.fromfile(ho_golden, dtype=np.float32) # 从bin文件读取预期运算结果\n",
    "ho_golden"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "result = np.abs(o_result - o_golden) # 计算运算结果和预期结果偏差\n",
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "h_result = np.abs(ho_result - ho_golden) # 计算运算结果和预期结果偏差\n",
    "h_result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "MindSpore",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
